#/bin/bash

# 关闭服务所需参数
export ModelName=$1
export ModelPath=/mnt

# 检查是否提供了足够的参数
if [ -z "$ModelName" ]; then
    echo "使用方法: $0 <模型名称>"
    exit 1
fi

if lspci | grep -q "d500"; then
    echo "检测到 d500 设备，停止 310 版本"
    export ServicePath=$(pwd)/310/service-run.sh
    export ConfigPath=$(pwd)/310/config.json
    cd "$(pwd)/310" && docker-compose down
elif lspci | grep -q "d802"; then
    echo "检测到 d802 设备，停止 910 版本"
    export ServicePath=$(pwd)/910/service-run.sh
    export ConfigPath=$(pwd)/910/config.json
    cd "$(pwd)/910" && docker-compose down
else
    echo "错误：未检测到 d500 或 d802 设备"
fi